import java.util.Scanner;
public class isPrime {
    public static void main(String[] args) {
        System.out.println("请输入一个正整数：");
        Scanner scanner=new Scanner(System.in);
        int N;
        N=scanner.nextInt();
        System.out.printf("1-%d的质数有:",N);
        for(int j=2;j<=N;j++) {
            if (zhishu(j)) {
                System.out.printf("%d,", j);
            }
        }
        System.out.println("\n");
    }

    public static boolean zhishu(int j) {
        if (j == 1) {
            return false;
        }
        else if(j==2){
            return true;
        }
        else{
            for (int i = 2; i < j; i++) {
                if (j % i == 0) {
                    return false;
                }
            }
        }
        return true;
    }
}
